<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>表单验证</title>
	<style type="text/css">
		label{
			text-align: center;
		}
		*{
			font-family: "微软雅黑";
			font-size: 15px;
		}
		input{
			margin: 10px;
			width: 200px;
			height: 30px;
		}
		span{
			color: red;
		}
		form{
			margin-left: 40px;
		}
	</style>
</head>
<body>
	<form action="zz.php" method="post">
		<label for="">用户名：</label><input type="text" name="ursename"><span>*</span>
		<br>
		<label for="">密&nbsp;&nbsp;&nbsp;码：</label><input type="password" name="password"><span>*</span><br>
		<label for="">邮&nbsp;&nbsp;&nbsp;箱：</label><input type="text" name="email"><span>*</span><br>
		<label for="">电&nbsp;&nbsp;&nbsp;话：</label><input type="text" name="phone"><span>*</span><br>
		<input type="submit" name="submit" value="提交">
		
	</form>
	<?php 
			include "shuju.php";
			if(isset($_POST["submit"])){
			$username = $_POST["ursename"];
			$password = md5($_POST["password"]);
			$email = $_POST["email"];
			$phone = $_POST["phone"];
			$db = new DB();
			$sql = "select * from lll where name = '$username'";
			if ($db->get($sql)) {
				echo "已经注册！";
			}else{
				$sql = "insert into lll values(null,'$username','$password','$email','$phone',0)";
			$db->insert($sql);
			}
		}

		 ?>
</body>
</html>